package com.zhijiaoyun.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zhijiaoyun.dao.IAuthorityDao;
import com.zhijiaoyun.model.Authority;
import com.zhijiaoyun.service.IAuthorityService;

/**
 * @author shisfish
 * @date 2017/6/6
 */
@Service(value = "authorityService")
public class AuthorityServiceImpl implements IAuthorityService {

	@Resource
	IAuthorityDao authorityDao;
	
	@Override
	public Authority getAuthorityByName(String name) {
		return authorityDao.selectByName(name);
	}

	@Override
	public void addAuthority(Authority authority) {
		authorityDao.insert(authority);
	}

	@Override
	public Authority getAuthorityByAuthorityId(Long authorityId) {
		return authorityDao.selectByPrimaryKey(authorityId);
	}

	@Override
	public Authority getAuthorityByNameNotAuthorityId(Long authorityId, String name) {
		return authorityDao.selectByNameNotAuthorityId(authorityId, name);
	}

	@Override
	public void modifyAuthority(Authority authority) {
		authorityDao.updateByPrimaryKey(authority);
	}

	@Override
	public List<Authority> getByParams(String name) {
		return authorityDao.selectByParams(name);
	}

}
